package com.netty.algorithm;

import io.netty.util.HashedWheelTimer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.concurrent.TimeUnit;

/**
 * @author xl-9527
 * @since 2024/6/15
 **/
public class HashedWheelTimerDemo {

    private static final Logger log = LoggerFactory.getLogger(HashedWheelTimerDemo.class);

    public static void main(String[] args) {
        final HashedWheelTimer wheelTimer = new HashedWheelTimer(1, TimeUnit.SECONDS, 60 * 60);
        wheelTimer.newTimeout(timeout -> log.info("我正在执行"), 2, TimeUnit.SECONDS);
        wheelTimer.newTimeout(timeout -> log.info("我正在执行"), 100, TimeUnit.SECONDS);
    }
}
